//
//  SendCoinViewController.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/5/4.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit

class SendCoinViewController: BaseViewController {
    var viewModel:SendCoinViewModel?
    lazy var sendCoinView:SendCoinView = {
        let view = SendCoinView(dataSource: viewModel)
        
        return view
    }()
    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
        viewModel = SendCoinViewModel(controller: self)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        viewModel?.changeModel()
        
        view.addSubview(sendCoinView)
        sendCoinView.snp.makeConstraints { (make) in
            make.top.left.bottom.right.equalToSuperview()
        }
        sendCoinView.setModel()
        viewModel?.archiveCharge()
        APPAssetInfo.default.archiveCoinInformation(block: {
            self.viewModel?.changeModel()
            self.sendCoinView.setModel()
            self.sendCoinView.changeInformation()
        })
        
        CYMBShow.openIndicator(message: nil, view: self.view)

        weak var weakSelf = self
        AppSecurityInfo.default.archiveSecurityInfo(success: { (result) in
            CYMBShow.colseIndicator(view: weakSelf?.view)
        }) { (response) in
            CYMBShow.colseIndicator(view: weakSelf?.view)
        }
    
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
